package com.yhsimon.state;

//线程强制执行
public class TestThreadJoin implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i <100; i++) {
            System.out.println("这货来插队了"+i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        //自定义线程
        TestThreadJoin join = new TestThreadJoin();
        Thread thread = new Thread(join);
        thread.start();

        //主线程
        for (int i = 0; i < 500; i++) {
            if(i==200){
                thread.join();//插队
            }
            System.out.println("main"+i);
        }


    }
}
